# __author__ = 'heyin'
# __date__ = '2018/11/9 17:07'
# a = 7902.668921875
# 保留三位小数
# print(round(a, 3))

# from pyecharts import Scatter3D
#
# import random
# data = [
#     [random.randint(0, 100),
#     random.randint(0, 100),
#     random.randint(0, 100)] for _ in range(80)
# ]
# range_color = [
#     '#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf',
#     '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
# scatter3D = Scatter3D("3D 散点图示例", width=1200, height=600)
# scatter3D.add("", data, is_visualmap=True, visual_range_color=range_color)
# scatter3D.render()

import numpy as np

# a = np.array([[1.2, 2.1, np.nan], [2.222, 1.111, np.nan]])
# print(a)
# a = np.around(a, 1)
# print(a)

# b = np.array([[1,None],[2,None]])
# print(b)
# print(b == None)
# b[b==None] = np.nan
# print(b)
# a = b.astype(np.float64)
# print(a == a)
# print(np.isnan(a))
# print(a)


# a = np.array([[1, 2], [2, 3]])
# b = np.array([[1], [2]])
# print(a)
# print(b)
# print(np.hstack((a, b)))

import pandas as pd

# d = pd.DataFrame(np.arange(12).reshape((3, 4)), index=['a', 'b', 'c'], columns=['A', 'B', 'C', 'D'])
# print(d)
#
# d.loc[:, 'E'] = [1, 2, 3]  # 直接传递列表，不是series，没有index
# print(d)
#
# s = pd.Series(list(range(3)))
# print(s)
# d['G'] = s  # 因为s默认是有索引的，因此和d中的索引不符合，赋值后会导致G这列数据全部是NaN
# print(d)
# # 解决上边的问题，将series变为列表后再进行赋值，即可快速添加
# # 复杂的方式，在获取series时，将其index指定为原df的index
# d['F'] = list(s)
# print(d)

# 同时添加多列数据，不清楚怎么添加多列，还是将多列拆分为单列后，添加


import requests
import json

ret = requests.get('http://192.168.3.191:8007/resource/api/29/?username=admin&appkey=30ec9825b0be44e0b9f01f750a9d779a')
print(json.loads(ret.content.decode(encoding='utf-8')))
print(ret.content.decode(encoding='utf-8'))
